package cn.tedu.boot031.mapper;

import cn.tedu.boot031.entity.Product;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface ProductMapper {
    @Insert("INSERT INTO product VALUES(#{id},#{title},#{price},#{num})")
    int insert(Product product);
    @Select("SELECT * FROM product")
    List<Product> select();
    @Update("UPDATE product SET title=#{title},price=#{price},num=#{num} WHERE id=#{id}")
    int update(Product product);
    @Delete("DELETE FROM product WHERE id=#{id}")
    int delete(int id);
}
